package com.tanhua.model.vo;

import com.tanhua.model.db.UserInfo;
import com.tanhua.model.mongo.Sound;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SoundVo implements Serializable {
    //用户信息
    private Long userId;//用户id
    private String avatar; //用户头像
    private String nickname; //昵称
    private String gender; //性别
    private Integer age; //年龄
    //语音信息

    private String soundUrl; //声音文件，URL
    //构造vo对象的时候 设置上去即可
    private Integer remainingTimes;//剩余次数

    public static SoundVo init(UserInfo userInfo, Sound sound){
        SoundVo vo = new SoundVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo,vo);
        //copy声音属性
        BeanUtils.copyProperties(sound,vo);
        return vo;
    }
}
